// Parser class provides a set of functions for string manipulation and parsing.
// Provides functions to parse a string into Date, Time, or other types.

//@author A0099619J
#ifndef _PARSER_H_
#define _PARSER_H_

#include <string>
#include <vector>
#include <regex>
#include <assert.h>
#include "constants.h"
#include "Logging.h"
#include "Time.h"
#include "Date.h"

class Parser
{
private:
	static const std::string monthsShort[];
	static const std::string months[];
	static const std::string daysShort[];
	static const std::string days[];
	static const std::string TODAY;
	static const std::string TOMORROW;
	static const std::string AM;
	static const std::string PM;

	static const regex dateFormat;
	static const regex condensedDateFormat;
	static const regex integerDateFormat;
	static const regex timeFormat;
	
	static bool matchDay(std::string, Date&);
	static bool matchDate(std::string, Date&);
public:
	static void splitString(std::string, vector<std::string> &);
	static void trimSpaces(std::string &);
	static string toLower(const std::string &);

	static CommandType parseCommandType(std::string);
	static bool parseTaskTypeAndIndex(std::string, TaskType &, int &);
	static bool isPositiveInteger(const std::string&);
	static Date parseDate(std::string);
	static Time parseTime(std::string);
};

#endif